package com.chuangjiangx.member.coupon.ddd.domain.model;

import lombok.Getter;

/**
 * Created by zhoufushou on 2017/12/16.
 * 卡券有效类型
 */
@Getter
public enum ValidType {
    FIXED_DATE("指定日期", 0),
    EFFECT_DAYS("有效天数", 1);

    public final String name;
    public final Integer code;

    ValidType(String name, Integer code) {
        this.name = name;
        this.code = code;
    }

    public static ValidType getType(Integer code){
        for(ValidType back : values()){
            if(back.code.equals(code)){
                return back;
            }
        }
        return null;
    }
}
